package com.nchu.student_score.controller;

import com.github.pagehelper.PageInfo;
import com.nchu.student_score.model.Term;
import com.nchu.student_score.service.TermService;
import com.nchu.student_score.vo.ResultVo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/term")
public class TermController {
    @Resource
    TermService termService;

    @RequestMapping("getTermList/{currPage}")
    public PageInfo<Term> getTermList(@RequestBody Term term, @PathVariable Integer currPage){
        return termService.getTermList(currPage);
    }

    @RequestMapping("updateTerm")
    public ResultVo<Term> updateTerm(@RequestBody Term term){
        return termService.updateTerm(term);
    }

    @RequestMapping("getTerms")
    public ResultVo<Term> getTerms(){
        return termService.getTerms();
    }
}
